package com.wr.common.web.interceptor;

import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 初始化常量的拦截器
 */
public class ConstantsInterceptor implements HandlerInterceptor {

    private static final String HOST_CDN="http://itoken.wr.com:80";


//    private static final String TEMPLATE_ADMIN_LTE="adminlte/v2.4.3";



    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        return true;
    }

    @Override
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
        if (modelAndView!=null){
//            modelAndView.addObject("adminlte",HOST_CDN + "/" + TEMPLATE_ADMIN_LTE);
            modelAndView.addObject("adminlte",HOST_CDN);
        }
    }

    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {

    }
}
